# Copyright (c) 2024 Huawei Technologies Co., Ltd.
# This file is a part of the CANN Open Software.
# Licensed under CANN Open Software License Agreement Version 1.0 (the "License").
# Please refer to the License for details. You may not use this file except in compliance with the License.
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
# See LICENSE in the root of the software repository for the full text of the License.
# ======================================================================================================================

set(CMAKE_CXX_STANDARD 17)
# include directories
include_directories(${METADEF_DIR})
add_compile_definitions(TOP_DIR=\"${METADEF_DIR}\")
file(GLOB_RECURSE UT_FILES CONFIGURE_DEPENDS "${METADEF_DIR}/tests/ut/sc_check/testcase/*.cc")
add_executable(ut_sc_check ${UT_FILES})

target_compile_options(ut_sc_check PRIVATE
    -g --coverage -fprofile-arcs -ftest-coverage
    -Wno-deprecated-declarations
    -Wall -Wfloat-equal -Werror
    -D_GLIBCXX_USE_CXX11_ABI=0
)

target_compile_definitions(ut_sc_check PRIVATE
    $<$<STREQUAL:${ENABLE_OPEN_SRC},True>:ONLY_COMPILE_OPEN_SRC>
    google=ascend_private
    FUNC_VISIBILITY
)

target_link_libraries(ut_sc_check PRIVATE
    -lgcov
    -Wl,--no-as-needed
    -lstdc++fs
    GTest::gtest GTest::gtest_main slog_stub slog c_sec json mmpa_stub -lrt -ldl
)
